package main

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"os"
)

func Hello(ctx *gin.Context) {
	//ctx.String(200, "hello Gin!")
	name := "JacksonPeng"
	ctx.HTML(200, "index/index.html", name)
}

func User(ctx *gin.Context) {

	ctx.HTML(200, "user/user.html", nil)
}

func main() {
	dir, _ := os.Getwd()
	fmt.Println("Current working directory:", dir)
	router := gin.Default()
	// Arouter := gin.New()

	// Arouter.GET("/", func(ctx *gin.Context){
	//
	//	ctx.String(200,"hello gin")
	//})

	// 指定template 文件夹
	router.LoadHTMLGlob("template/**/*") // 推荐这个
	//Arouter.LoadHTMLFiles("index.html", "new.html")

	router.GET("/", Hello)
	router.GET("/user", User)

	router.Run(":8080")
}
